package 补充.输入输出操作.文件操作;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.SequenceInputStream;

public class 合并流 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis1 = new FileInputStream("D:\\Learn\\javademo\\untitled\\src\\补充_偏\\输入输出操作\\read.txt");
        FileInputStream fis2 = new FileInputStream("D:\\Learn\\javademo\\untitled\\src\\补充_偏\\输入输出操作\\read2.txt");
        SequenceInputStream sis = new SequenceInputStream(fis1, fis2);
        FileOutputStream fos= new FileOutputStream("D:\\Learn\\javademo\\untitled\\src\\补充_偏\\输入输出操作\\文件\\read.txt");
        int len = 0;
        byte[] b = new byte[1024];
        while ((len=sis.read(b))!=-1){
            fos.write(b,0,len);
            fos.write("\r\n".getBytes());
        }
        sis.close();
        fos.close();
    }
}
